package com.qs.rest.filters;

import java.security.GeneralSecurityException;
import com.qs.entities.UserSession;
import com.qs.exceptions.ServiceException;
import com.qs.services.SessionService;

public final class UserAuthenticator {
    
    public SessionService 	sessionService;
    
    public UserSession isSessionIdValid( String sessionId ) throws GeneralSecurityException {
    	try{
    		return sessionService.fetchSessionById(sessionId);
    	}
    	catch(ServiceException exc){
    		throw new GeneralSecurityException(exc.getMessage(),exc);
    	}
    }
    
	public void setSessionService(SessionService sessionService) {
		this.sessionService = sessionService;
	}
	
}
